package net.xo68.destiny.manager.service;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import lombok.extern.slf4j.Slf4j;
import net.xo68.destiny.manager.entity.JobInstanceExtend;
import net.xo68.destiny.manager.mapper.JobInstanceExtendMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;



/** 
 * JobInstanceExtend Service
 * @author wuxie(16349023@qq.com)
 * @date 2020年12月21日 21:43:52
 *
 */
@Slf4j
@Service
public class JobInstanceExtendService{
    
    @Autowired
    private JobInstanceExtendMapper jobInstanceExtendMapper;

    public JobInstanceExtend find(String extKey) {
        return  jobInstanceExtendMapper.find(extKey);
    }

    public JobInstanceExtend insert(JobInstanceExtend jobInstanceExtend) {
        jobInstanceExtendMapper.insert(jobInstanceExtend);
        return jobInstanceExtend;
    }

    public JobInstanceExtend update(JobInstanceExtend jobInstanceExtend) {
        jobInstanceExtendMapper.update(jobInstanceExtend);
        return jobInstanceExtend;
    }

    
    public List<JobInstanceExtend> list() {
        return jobInstanceExtendMapper.list();
    }
	
	public PageInfo<JobInstanceExtend> list(int pageNumber,int pageSize) {
        PageHelper.startPage(pageNumber, pageSize,true);
        List<JobInstanceExtend> docs = jobInstanceExtendMapper.list();
        PageInfo<JobInstanceExtend> pageInfo = new PageInfo<JobInstanceExtend>(docs);
        return pageInfo;
    }

    public void delete(long instanceId, String extKey) {
        jobInstanceExtendMapper.delete(instanceId,extKey);
    }
}